<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HUI 用户注册界面</title>
<link rel="stylesheet" type="text/css" href="css/hui.css" />
</head>
<body style="background:#F4F5F6;">
<header class="hui-header">
    <div id="hui-back"></div>
    <h1>用户登录</h1>
</header>
<div class="hui-wrap">
    <div class="hui-center-title" style="margin-top:35px;"><h1 style="border:0px;">公司LOGO位置</h1></div>
    <div style="margin:28px; margin-bottom:15px;" class="hui-form" id="form1">
        <div class="hui-form-items">
            <input id="phoneNum" type="text" class="hui-input hui-input-clear" placeholder="手机号码" checkType="phone" checkData="5,20" checkMsg="手机号码格式错误" />
        </div>
        <div class="hui-form-items">
            <input id="pwd" type="password" class="hui-input hui-pwd-eye" placeholder="登录密码" checkType="string" id="pwd" checkData="6,20" checkMsg="密码应为6-20个字符" />
        </div>
    </div>
    <div style="padding:28px; padding-top:0px; margin-top: 40px;">
        <button type="button" class="hui-button hui-button-large hui-primary" id="submit">登录系统</button>
    </div>
    <div style="padding:28px; padding-top:0px;">
        <button type="button" onclick="userReg()" class="hui-button hui-button-large hui-danger" id="submit">注册帐号</button>
    </div>
</div>
<script type="text/javascript" src="js/hui.js" charset="UTF-8"></script>
<script src="js/hui-form.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
hui('#submit').click(function(){
    //验证
    var res = huiFormCheck('#form1');
    //提交
    if(res){
	    var phone = hui("#phoneNum").val();
	    var pwd = hui("#pwd").val();
	    hui.post(
		    url_root+':8080/st/servlet/UserServlet',
		    {method:'userLogin', phone:phone,pass:pwd},
		    function(msg){
		    	if(msg=="error"){
		    		hui.iconToast('用户名或密码错误', 'warn');
		    	}else{
		    	var name = localStorage.setItem("nowUser",msg);
		    	hui.open('yonghu.html?_='+new Date().getTime());
		    	}
		    },
		    function(e){
		        hui.iconToast('网络故障', 'warn');
		    }
		);
    
    }
    
    
    
});

function userReg(){
	hui.open("reg.html");
}

</script>
</body>
</html>